<template id="resumeList">
  <div>
    <van-swipe-cell :before-close="beforeClose">
      <div class="_item" @click="link_bank">
        <div class="left_item">
          <img class="txImg" :src="imgSrc" alt >
        </div>
        <div class="right_item">
          <div class="item_row clearfix">
            <span class="job_name overflow">{{data.xm}}</span>
            <span class="sex">{{`${data.xb}${data.nl?' · '+data.nl+'岁':''}`}}</span>
            <a v-if="data.sfgkdh == '1'" :href="'tel:' + data.sj" class="tel" @click.stop></a>
            <!-- <span class="tel" v-show="data.sfgkdh == '1'" @click.stop @click="call"></span> -->
            <span class="job_money overflow">
              <span class="num">{{data.xc}}</span>
            </span>
          </div>
          <div class="item_row clearfix" v-show="data.zpgwmc">
            <p class="tdgw">投递岗位：<span>{{data.zpgwmc}}</span></p>
          </div>
          <div class="item_row last_row clearfix">
            <span class="jobName maxWidth overflow"
            >{{data.gwmc+' · '+data.whcd }}</span>
            <span
              class="SeachBtn success done"
              v-show="showYs || data.sfkyy == '1'"
              @click.stop="yyFn">邀约</span>
          </div>
        </div>
      </div>
      <template #right v-if="visibleSlide">
        <van-button square :text="slideText" type="danger" class="slide-button"/>
      </template>
    </van-swipe-cell>
  </div>
</template>
<script>
import viewNum from "@/common/js/configuration";
export default {
  name: "resumeList",
  props: {
    data: {
      type: Object
    },
    visibleSlide: {
      type: Boolean
    },
    slideText: {
      type: String,
      default: "删除"
    },
    showYs:{
      type:Boolean,
      default:true
    }
  },
  computed:{
    imgSrc() {
      return `${conf.urlPrefix}/dwgl/tpxxCx?jlid=${this.data.jlid}`;
    }
  },
  methods: {
    // 邀约事件
    yyFn(){
      this.$emit('yyfn',this.data);
    },
    // 电话
    call() {
      if (this.data.sj) {
        const href = `tel:${this.data.sj}`;
        var a = document.createElement('a');
        a.setAttribute('href', href);
        document.body.appendChild(a);
        a.click();
      }
    },
    brightenKeyword(val) {
      const GET_session = sessionStorage.getItem("qwgjz");
      if (GET_session && val) {
        var SearchArr = GET_session.split("");
        var res = val;
        for (let i = 0; i < SearchArr.length; i++) {
          let reg = /^[\u2E80-\u9FFF]+$/;
          if (!reg.test(SearchArr[i])) continue;
          var Reg = new RegExp(SearchArr[i], "g");
          res = res.replace(
            Reg,
            `<span style="color: #fb4d64;">${SearchArr[i]}</span>`
          );
        }
        return res;
      } else {
        return val;
      }
    },
    beforeClose({ position, instance }) {
      switch (position) {
        case "cell":
        case "outside":
          instance.close();
          break;
        case "right":
          this.$confirm("确定"+this.slideText+"吗？", "提示")
            .then(() => {
              this.$emit('slideFn',this.data)
            })
            .catch(() => {

            });
          break;
      }
    },
    link_bank() {
      this.$emit("link", this.data);
    }
  }
};
</script>
<style lang="scss" scoped>
@import "~common/scss/var.scss";
._item {
  // height: $height-input * 2;
  margin: $height-base/10 0;
  border-radius: $radius-base3;
  background-color: #fff;
  display: flex;
  flex-wrap: wrap;
  .left_item {
    margin: 34px;
    height: 116px;
    width: 116px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #ececec;
    box-sizing: border-box;
    .txImg {
      flex: 0 0 auto;
      max-width: 100%;
    }
  }
  .right_item {
    flex: 1 0 auto;
    padding: 34px 0;
    .item_row {
      margin-bottom: 14px;
      height: 50px;
      line-height: 50px;
      color: #4d4d4d;
      padding-right: 34px;
      overflow: hidden;
      .tdgw{
        width: 100%;
        color:#999;
        span{
          color:#4d4d4d
        }
      }
      .job_name {
        font-weight: 400;
        font-size: 34px;
        min-width: 66px;
        max-width: 164px;
        float: left;
      }
      .sex {
        font-size: 26px;
        padding: 0 15px;
      }
      .tel {
        background: url("~common/images/index/phone.png") 0 0 no-repeat;
        display: inline-block;
        height: 34px;
        width: 34px;
        background-size: 34px;
        vertical-align: middle;
      }
      .job_money {
        float: right;
        color: #817e81;
        font-size: $font-size-small;
        max-width: 244px;
        text-align: right;
        word-wrap: break-word;
        .num {
          display: inline-block;
          width: 100%;
          color: #fb4d64;
          // font-size: $font-size-large;
          font-size: $font-size-base;
        }
      }
      .jobName {
        float: left;
        font-size: $font-size-small;
        color: $color-text-label;
        height: 50px;
        line-height: 50px;
      }
      .maxWidth {
        width: 398px !important;
        padding-right: 6px;
        box-sizing: border-box;
      }
      .SeachBtn {
        float: right;
        width: 134px;
        height: 50px;
        line-height: 50px;
        border-radius: 4px;
        color: #fff;
        font-size: 26px;
        // text-align: center;
      }
      .success {
        background: #d1d1d1;
      }
      .success::before,
      .done::before {
        content: "";
        float: left;
        height: 26px;
        line-height: 26px;
        margin: 12px;
        width: 26px;
        background: url("~common/images/index/send_.png") 0 0 no-repeat;
        background-size: 26px;
      }
      .success {
        background: #06a8f6;
      }
      .done::before {
        margin: 12px 14px 0 24px;
        background: url("~common/images/index/send.png") 0 0 no-repeat;
        background-size: 26px;
      }
    }
    .last_row {
      margin-bottom: 0;
    }
  }
}
._item:first-child {
  border-radius: 0 0 $radius-base3 $radius-base3;
  margin-top: 0;
}
/deep/ .van-swipe-cell__right button {
  height: 100%;
}
.slide-button {
  background-color: #e86060;
  border: 1px solid #e86060;
  .van-button__text {
    font-size: 28px;
  }
}
</style>
